import java.io.BufferedReader;
import java.io.Console;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;

import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.MessageProducer;
import javax.jms.ObjectMessage;
import javax.jms.Session;

import jpa.entities.ClientBestelling;

import javax.jms.*;

import jpa.entities.BestellingPK;
import jpa.entities.ClientBestelling;

import org.apache.activemq.ActiveMQConnection;
import org.apache.activemq.ActiveMQConnectionFactory;


public class Client {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Bestel c = new Bestel();
		System.out.println("Aanwezige producten:");
		System.out.println("Productsoort: \t Productnaam \t ProductID");
		System.out.println("Hardware \t Laptop \t 18");
		System.out.println("Hardware \t SSD \t \t 12");
		System.out.println("McDonalds \t Hamburger \t 10");
		System.out.println("McDonalds \t Snitzel \t 8");
		
		HashMap<Integer, String> producten = new HashMap<Integer,String>();
		producten.put(18,"Hardware");
		producten.put(12,"Hardware");
		producten.put(10,"McDonalds");
		producten.put(8,"McDonalds");
		
		
		System.out.println("Geef van het te bestellen product het ProductID op. Om af te sluiten voer exit in.");

		BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
		boolean bezig = true;
		while(bezig)
		{
			String message = "";
			System.out.println("waarde");
			try {
				message = stdin.readLine().trim();
				System.out.println(message);
				if(message.equals("exit"))
				{
					System.exit(0);
				}
				else
				{
					int productID = Integer.parseInt(message);
					if(producten.containsKey(productID))
						c.bestel(productID, producten);
					else
						System.out.println("Product niet gevonden");
				}
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}

		}
		
	}
}
